[cpp] Callable comparison handling - #12763
Conversation
Otherwise they'd match against other functions of the same signature
|
Cpp tests failing are expected until that hxcpp side is merged, but it seems like jvm and neko also fail to handle this. |
|
Hmm, I thought this was handled on JVM by overriding |
|
I'm still not sure about this in general because in my opinion the equality check is simply lying here. I suppose one could say that this is true for strings as well because we don't check physical equality on them. And I guess it's a bit too late to discuss this anyway since it has been specified like this for a while now (although apparently not well tested). Not sure what to do with neko though and if somebody wants to look into fixing that. It might be best to just ignore the tests on neko for now. |
|
I'm happy to sweep the failing neko test under the carpet. I agree that this all seems odd, I had no idea functions had all these odd comparison cases until I started reworking hxcpp's closures. Hopefully there's not too much mad code out these using it... |
Closes #12746
Hxcpp side : HaxeFoundation/hxcpp#1313
I've suspected there was some issues around this sort of thing, but the tests didn't throw anything up. Because the new callable handling creates wrapper functions for differing signatures, comparions between closures could start to go wrong.
This introduces a new based class for the callable which exposes a function which returns it's type, which is independent of the callable object itself. The value returned from this is then used for closure comparisons.